import Vue from 'vue'
import VueRouter from 'vue-router'
// 标准写法
// import Login from '@/views/login/index.vue'
Vue.use(VueRouter)

const routes = [
  // {path:'/',comments:Login}
  {
    path: '/',
    redirect: '/home',
    component: () => import('@/views/layout'),
    children: [
      { path: '/home', component: () => import('@/views/Home') },
      { path: '/qa', component: () => import('@/views/Qa') },
      { path: '/video', component: () => import('@/views/video') },
      { path: '/my', component: () => import('@/views/My') }
    ]
  },
  // { path: '/', redirect: '/login' },
  // {path:'/login' co}
  // 方法2 简化写法(又称懒人写法)
  { path: '/login', component: () => import('@/views/login') },
  { path: '/search', component: () => import('@/views/search') },
  { path: '/article/:articleId', component: () => import('@/views/article/index.vue'), props: true },
  { path: '/user/profile', component: () => import('@/views/userProfile/index.vue') }

]

const router = new VueRouter({
  routes
})

export default router
